subroutine read_nstop(nstp,e,sn)
  use param
  use fptr
  implicit none
  integer,intent(in) :: nstp
  real(dbl),intent(in) :: e
  real(dbl),intent(out) :: sn
  integer :: i
  real(dbl) :: e1,r1,e2,r2
  do i=pptr,lenp,2
     read(nstp,rec=i) e1
     read(nstp,rec=i+1) r1
     if (e.le.e1) then
        if (pptr.gt.4) then
           read(nstp,rec=i-2) e2
           read(nstp,rec=i-1) r2
           pptr=i
           sn=r2+(r2-r1)*(e-e1)/(e2-e1)
           return
        else
           sn=0
           return
        end if
     end if
  end do
  write(*,'(3x,"Err-read_nstop-Energy=",1pe9.3,1x,"is out of range.")') e
  stop
end subroutine read_nstop
